package com.deer.wms.base.system.service.bill;


import com.deer.wms.base.system.model.bill.*;
import com.deer.wms.base.system.model.task.TaskInfoDto;
import com.deer.wms.base.system.model.zh.WorkTasks;
import com.deer.wms.common.core.service.Service;

import java.util.List;

/**
 * 出库单 服务层
 * 
 * @author guo
 * @date 2019-05-13
 */
public interface IBillOutMasterService  extends Service<BillOutMaster, Integer>
{

    /**
     * 根据billId查询出库单信息
     */
    public BillOutMasterDto findBillOutMasterDtoByBillId(Integer billId);
    /**
     *
     * @author 李帅辰
     * @date 17:50 2020/10/30
     * @params BillNo
     * @return com.deer.wms.base.system.model.bill.BillOutMasterDto
     **/
    public BillOutMasterDto findBillOutMasterDtoByBillNo(String billNo);


    /**
     * 删除入库单信息
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteBillOutMasterByIds(String ids);


    /**
     * 修改BillOutMaster信息
     *
     * @param billOutMaster
     */
    public int updateBillOutMaster(BillOutMaster billOutMaster);

    /**
     * 出库单审核通过
     * @param billId
     * @return
     */
    int auditFinish(Integer billId);

    /**
     * 根据billId查找BillOutMaster
     *
     * @return
     */
    public BillOutMaster selectBillOutMasterById(Integer billId);

    /**
     * 保存BillOutMaster  出库单
     *
     * @param billOutMaster
     */
    public Boolean saveBillOutMaster(BillOutMaster billOutMaster);



    /**
     *
     * 查询出库单
     *
     * @return
     */
    public List<BillOutMasterDto> selectBillOutMasterList(BillOutMasterDto billOutMasterDto);

    /**
     * 根据billOutDetailId查询billoutMaster信息
     */
    BillOutMaster selectBillOutMasterByBillOutDetailId(Integer billOutDetailId);

    /**
     * 根据条件查询相应出库单据
     * @param criteria
     * @return
     */
    List<BillOutMasterDto> findList(BillOutMasterCriteria criteria);

    List<BillOutMasterDto> findExport(BillOutMasterCriteria criteria);

    /**
     * 获取出库单据的总数
     */
    int BillOutMasterCount();

    /**
     * 获取状态下的总数
     * @return
     */
    int BillOutMasterCountByType();
    /**
     * 折线图 每天的总数
     * @return
     */
    List<Integer> getAllWeek();

    /*出库流水*/
    List<BillOutDetailDeviceDto> selectDetailStreamList(BillOutDetailDeviceDto billOutDetailDeviceDto);
    /*根据billId查询出库计划*/
    List<BillOutPlanDto> findBillOutPlanByBillId(Integer billId);
    /*根据出库计划id查询出库明细*/
    List<BillOutDetailDto> findBillOutDetailByPlanId(Integer planId);
    /*根据出库明细id查询机台列表明细*/
    List<BillOutDetailDto> findDeviceListByDetailId(BillOutDetail billOutDetail);
    /*出库计划查询*/
    List<BillOutPlanDto> selectBillOutPlanList(BillOutPlanDto billOutPlanDto);
    /*待出库单列表*/
    List<BillOutMasterDto> selectWaitBillOutMasterList(BillOutMasterDto billOutMasterDto);
    /*查询机台列表*/
    List<DeviceManager> findDeviceList(DeviceManager deviceManager);
    /*根据出库单id查sap物料明细*/
    List<MATNRvo> findMATNRByBillId(Integer billId);
    /*新建出库计划*/
    void insertBillOutPlan(BillOutPlan billOutPlan);
    /*新建出库计划明细*/
    void insertBillOutDetail(BillOutDetail billOutDetail);
    /*新建机台明细*/
    void insertBillOutDetailDevice(BillOutDetailDevice billOutDetailDevice);
    /*根据planId查询出库计划*/
    BillOutPlanDto findBillOutPlanByPlanId(Integer planId);
    /*明细添加任务id*/
    void saveTaskId(BillInDetail billInDetail);
    /*根据出库计划id查询未出库明细*/
    List<BillOutDetailDto> getBillOutDetailByPlanId(Integer billOutPlanId);
    /*根据sapId修改对应入库单的sapNo*/
    void updateSapNoBySapId(BillOutSap billOutSap);
    /*改明细状态*/
    void updateBillOutDetailStateById(Integer billOutDetailId);
    /*查询未完成明细数量*/
    int findBillOutOver(Integer planId);
    /*改变出库单状态*/
    void updateBillOutPlanState2(Integer billOutPlanId);
    void updateBillOutPlanState3(Integer billOutPlanId);
    /*根据计划id和物料名称查sap明细id*/
    int findSapIdByPlanId(WorkTasks workTasks);
    /*修改重量*/
    void updateSapWright(BillOutSapDetail billOutSapDetail);
    /*查对比重量*/
    BillOutSapDetail findDetailWeight(Integer sapId);
    /*更改状态*/
    void updateSapDetailState(BillOutSapDetail detailWeight);
    /*根据出库单id查计划是否完成*/
    int sumPlan(Integer billOutPlanId);
    /*查询SAPid*/
    int findSapIdByDetailId(Integer sapId);
    /*计划的那完成*/
    void updatePlan(Integer id);
    /*查出库类型*/
    Integer findBillOutType(Integer id);
    /*出库单强制完成*/
    void planOver(Integer billOutPlanId);
    /*出库明细强制完成*/
    void planDetailOver(Integer billOutPlanId);
    /*出库流水合计*/
    BillOutDetailDeviceDto getDetailSum(BillOutDetailDeviceDto detailAll);
}
